
import {
    getChildren_path,
    loadParentOrg_path,
    searchOrgByName_path,
    getOrgDetail_path,
    updateOrg_path,
    deleteOrg_path,
} from './path';

import {
    POST , GET , PATCH , DELETE
} from '@/plugins/axios';


//获取组织机构一级菜单
export const loadParentOrg = ()=> {
    return GET(loadParentOrg_path());
};
//根据父级id获取下一级菜单
export const getOrgChildren = (pid)=> {
    return GET(getChildren_path(pid));
};
//根据name，组织
export const searchOrgByName = (name = '')=> {
    return GET(searchOrgByName_path() , {orgName : name});
};

//机构详情
export const getOrgDetail = (orgId = '')=> {
    return GET(getOrgDetail_path(orgId));
};

//更新机构信息
export const updateOrg = (data = {})=> {
    return PATCH(updateOrg_path() , data , {'content-type' : 'application/json'} );
};
//新增保存机构信息
export const saveNewOrg = (data = {})=> {
    return POST(updateOrg_path() , data , {'content-type' : 'application/json'} );
};
//删除机构信息
export const deleteOrg = (orgId)=> {
    return DELETE(deleteOrg_path(orgId) );
};

